#ifndef FROM_STRING_H
#define FROM_STRING_H

// converts string to streamable value, and returns true on success and false otherwise.
template <class T>
bool from_string(T &Value,const std::string &str,std::ios_base & (*f)(std::ios_base&))
{
    std::istringstream stream(str);
    stream>>f>>Value;
    return (!stream.fail()) && stream.get()==std::istringstream::traits_type::eof();
}

#endif
